Forgive me if this has already been requested, but I would like to see the uc_product.module include a statement to allow for both thickbox and lightboxv2. I prefer lightboxv2 over thickbox and while it isn't a big deal to change the uc_product.module to reflect lightbox, I think encompassing the use of both viewers would make for a nicer "preference" experience depending on which viewer folks like using.
for anyone wishing to allow for lightbox, edit the uc_product.module and look for:
$thickbox_enabled = module_exists('thickbox');
change it to:
$lightbox_enabled = module_exists('lightbox2');
Next, search for anything else that says thickbox within the file and replace it with lightbox. Don't forget to change the class="thickbox" over to rel="lightbox" and if you want to group multiple images, just add something after the rel="lightbox" such as rel="lightbox[imggroup]"
I just implemented this option in a new v6 cart so I don't know what kind of problems I might face by changing everything over to lightbox, but it appears to be working great at this point :)
Otherwise, thx for the awesome shopping cart! Keep up the great work!
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | image_box.2.patch | 6.55 KB | cha0s |
| #5 | image_widget.patch | 6.55 KB | cha0s |
| #2 | image_box.patch | 5.72 KB | cha0s |
Comments
Comment #1
rszrama commentedThis question comes through quite regularly, and I think it comes down to Thickbox was just the first thing we tried and integrated. It wouldn't be a bad idea for the system to be pluggable, but I'm not sure if there's an effective way for us to do this in core since the systems rely on different markup (i.e. class vs. rel). If we can't feasibly support one over the other, then I'm not opposed to re-evaluating what we use. I'm postponing this for now unless someone wants to come in with a patch for review.
Comment #2
cha0s commentedThis patch creates a new hook, uc_image_widgets. it returns an associative array. The key is the internal name e.g. 'thickbox', the value is the description, e.g. 'The ThickBox image widget'.
Each image widget has a corresponding function called uc_image_widget_[widget internal name], i.e. uc_image_widget_thickbox. This function takes as a single argument the index (a.k.a. rel_count in theme_uc_product_image) of the image to display. If this is a single image, pass NULL. The function returns the relevant markup attributes, which are placed inside the link tag generated for each widget.
There's a dialog at admin/store/products/image-widgets which allows the user to select from image widgets that have been defined in such hooks. ThickBox and LightBox are implemented by default, but you can't select them at this dialog unless their modules have been enabled. If this patch is applied, you will have to visit this dialog at least once to enable the widget you'd like to use; the default is None.
I tested both thickbox and lightbox2, both seemed to function. =)
Comment #3
rszrama commentedWell, that was quick. ; )
Some feedback on semantics and code placement mostly:
As I think about this now, I'm wondering if the image widget hook / callbacks shouldn't go in uc_store.module. The particular setting for products could still go in the product settings form.
Hope this is helpful... I could've just made the changes myself prior to committing, but wanting to have a little more open/contagious thought process. : )
Comment #4
thill_ commentedI wanted to give this an awesome +1, this is great because the acquia latest release ships with lightbox2, which means having lightbox2 work with ubercart means no modules need to be loaded besides ubercart core on top of acquia waaahoooo
Comment #5
cha0s commentedthanks for the suggestions, Ryan. They have been incorporated in this latest patch. I wasn't sure what you mean by:
"Also related to the settings, with a radio select list like this, the title can essentially be what your description is w/ no description necessary... i.e. title => 'Image widget to use when a customer clicks on a product image'. Perhaps the description should then become => 'Third party modules offer pop-up support for viewing full sized product images. Ubercart core accommodates Thickbox and Lightbox2.'"
Since I didn't have a description on the last patch's radio dialog. I modified the language a bit though. Also, I had missed using t() there. I made a couple other little changes/fixes to make things work better with the suggestions.
P.S. Thanks for the kind words Tim. :)
Comment #6
thill_ commentedafter applying this to latest bzr i am getting this
Comment #7
cha0s commentedThanks, Tim... I forgot to rename the callback function when I updated the hook. Here's another patch that fixes that.
Comment #8
thill_ commentedAwesome, works much better now, great feature!
Comment #9
Island Usurper commentedLooks good. I think I might actually start using Lightbox2 for my test sites. :)
Comment #10
philsward commentedYou guys are awesome!! As a 'dumb' user (dumb meaning I can't program anything in php) I am at the full mercy of you smart php programmer folk to do the dirty work for me :) (Again, thanks!)
I too am surprised at the quick response to the issue as this was more of a whistles-and-bells feature implementation as opposed to the necessary core bugs which need more attention (and rightly so...)
I don't know if this has been implemented in the currently available beta2 or not but I am excited that this feature has taken hold and will allow for more customization of the ubercart experience. :)
Keep up the great work!
Comment #11
thill_ commentedIt is all set in the beta2 release, I have actually switched two live sites over and deleted thickbox.